package com.bball.court.controller.parse;

import android.test.AndroidTestCase;

/**
 * Created by fatou-kine.camara on 13-05-16.
 */
public class ParsePlayerControllerTest extends AndroidTestCase {
//    private PlayerController playerController;
//
//    private static final String PLAYER_EMAIL_1 = "player1@test.com";
//    private static final String PLAYER_EMAIL_2 = "player2@test.com";
//
//    private ParseCourt court;
//
//    @Override
//    protected void setUp() throws Exception {
//        super.setUp();
//
//        playerController = new ParsePlayerController();
//
//        playerController.signUp(PLAYER_EMAIL_1);
//
//        court = new ParseCourt();
//        court.setObjectId("myTestCourt1");
//        court.setName("RandomCourt");
//        Address address = new Address();
//        address.setCountry("Canada");
//        address.setState("Quebec");
//        address.setCity("Montreal");
//        address.setPostalCode("H2T1J4");
//        address.setStreet("Some street");
//        court.setAdress(address);
//        court.put(ParseCourtController.LOCATION, new ParseGeoPoint(43.240332, 0.052628));
//        try {
//            court.save();
//        } catch (ParseException e) {
//        }
//    }
//
//    public void testPlayerAlreadyExists() {
//        assertEquals(playerController.playerAlreadyExists(PLAYER_EMAIL_1), true);
//    }
//
//    public void testSignUp() {
//        assertEquals(playerController.playerAlreadyExists(PLAYER_EMAIL_2), false);
//        playerController.signUp(PLAYER_EMAIL_2);
//        assertEquals(playerController.playerAlreadyExists(PLAYER_EMAIL_2), true);
//    }
//
//    public void testLogin() {
//        playerController.login(PLAYER_EMAIL_1);
//        assertEquals(playerController.getCurrentPlayer().getUserId(), PLAYER_EMAIL_1);
//    }
//
//    public void testGetCurrentPlayer() {
//        playerController.login(PLAYER_EMAIL_1);
//        assertEquals(playerController.getCurrentPlayer().getUserId(), PLAYER_EMAIL_1);
//    }
//
//    public void testGetPlayerProfile() {
//        Player player = playerController.getPlayerProfile(PLAYER_EMAIL_1);
//        assertEquals(player.getUserId(), PLAYER_EMAIL_1);
//    }
//
//    public void testEditNickname() {
//        playerController.editNickname(PLAYER_EMAIL_1, "nouchnik");
//
//        Player player = playerController.getPlayerProfile(PLAYER_EMAIL_1);
//        assertEquals(player.getNickName(), "nouchnik");
//    }
//
//    public void testGetPlayersOnCourt() {
//        playerController.signUp(PLAYER_EMAIL_2);
//        playerController.checkInCourt(PLAYER_EMAIL_1, court.getObjectId());
//        playerController.checkInCourt(PLAYER_EMAIL_2, court.getObjectId());
//        assertEquals(playerController.getPlayersOnCourt(court.getObjectId()).size(), 2);
//    }
//
//    public void testDeletePlayer() {
//        playerController.signUp("test@delete.com");
//        assertEquals(playerController.playerAlreadyExists("test@delete.com"), true);
//
//        playerController.deletePlayer("test@delete.com");
//        assertEquals(playerController.playerAlreadyExists("test@delete.com"), false);
//    }
//
//    public void testCheckInCourt() {
//        assertEquals(playerController.getPlayersOnCourt(court.getObjectId()).size(), 0);
//        playerController.checkInCourt(PLAYER_EMAIL_1, court.getObjectId());
//        assertEquals(playerController.getPlayersOnCourt(court.getObjectId()).size(), 1);
//    }
//
//    public void testLeaveCourt() {
//        assertEquals(playerController.getPlayersOnCourt(court.getObjectId()).size(), 0);
//        playerController.checkInCourt(PLAYER_EMAIL_1, court.getObjectId());
//        assertEquals(playerController.getPlayersOnCourt(court.getObjectId()).size(), 1);
//
//        playerController.leaveCourt(PLAYER_EMAIL_1);
//        assertEquals(playerController.getPlayersOnCourt(court.getObjectId()).size(), 0);
//    }
//
//    @Override
//    protected void tearDown() throws Exception {
//        super.tearDown();
//
//        playerController.leaveCourt(PLAYER_EMAIL_1);
//        playerController.leaveCourt(PLAYER_EMAIL_2);
//
//        playerController.deletePlayer("test@delete.com");
//        playerController.deletePlayer(PLAYER_EMAIL_2);
//        playerController.deletePlayer(PLAYER_EMAIL_1);
//    }
}
